package com.lm.negotiation.controller;

import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api")
public class NegotiationController {
    @GetMapping(value = "/resource")
    public ResponseEntity<Object> getResource() {
        Map<String, String> data = new HashMap<>();
        data.put("id", "1");
        data.put("name", "Content Negotiation Example");

        return ResponseEntity.ok(data);
    }

    @GetMapping(value = "/resource.{format}", produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
    public ResponseEntity<Object>  getFormat() {
        Map<String, String> data = new HashMap<>();
        data.put("id", "1");
        data.put("name", "Content Negotiation Example");

        return ResponseEntity.ok(data);
    }
}
